package com.gitee.dupe.oauth.dto;

import com.gitee.dupe.oauth.enumeration.GrantType;
import com.gitee.dupe.oauth.enumeration.LoginNameType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * 登录参数
 *
 * @author LYH
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Builder
@ApiModel(value = "LoginDTO", description = "登录参数")
public class LoginDTO {

    @ApiModelProperty(value = "授权类型", notes = "若为PASSWORD,则code和key为图形验证码；若为REFRESH_TOKEN则仅需要token值", required = true)
    @NotNull(message = "授权类型不能为空")
    private GrantType grantType;

    @ApiModelProperty(value = "用户名类型")
    private LoginNameType loginNameType;

    @ApiModelProperty(value = "账号")
    private String loginName;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "验证码KEY")
    private String key;

    @ApiModelProperty(value = "验证码")
    private String code;

    @ApiModelProperty(value = "grantType=REFRESH_TOKEN时使用")
    private String token;
}
